using AutoMapper;
using Joy.Erp.BasicArchives.Core;

namespace Joy.Erp.BasicArchives.Asns
{
    public class AsnAutoMapperProfile : Profile
    {
        public AsnAutoMapperProfile()
        {
            CreateMap<Asn, AsnDto>().MapExtraProperties().ReverseMap();
            CreateMap<Asn, AsnDocumentDto>().MapExtraProperties().ReverseMap();
            CreateMap<Asn, AsnCreateDto>().MapExtraProperties().ReverseMap();
            CreateMap<Asn, AsnUpdateDto>()
                .MapExtraProperties()
                .ForMember(dest => dest.Children, opt => opt.Ignore());
            CreateMap<AsnUpdateDto, Asn>()
                .MapExtraProperties()
                .ForMember(dest => dest.Id, opt => opt.Ignore())
                .ForMember(dest => dest.OrderType, opt => opt.Ignore())
                .ForMember(dest => dest.Supplier, opt => opt.Ignore())
                .MapChildren<AsnUpdateDto, Asn, AsnLineCreateOrUpdateDto, AsnLine>();

            CreateMap<AsnLine, AsnLineDto>().MapExtraProperties().ReverseMap();
            CreateMap<AsnLine, AsnLineCreateOrUpdateDto>().MapExtraProperties().ReverseMap();
        }
    }
} 